package com.pz.gulimall.auth.feign;

import com.pz.gulimall.common.to.RegisterMemberTo;
import com.pz.gulimall.common.to.UserInfoTo;
import com.pz.gulimall.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@FeignClient("gulimall-member")
public interface MemberFeign {
    @RequestMapping("/member/member/save/register")
    R saveRegister(@RequestBody RegisterMemberTo member);

    @RequestMapping("/member/member/search")
    R queryMember(@RequestParam("id") String id);

    @RequestMapping("/member/member/info/{id}")
    R info(@PathVariable("id") Long id);

    @PostMapping("/member/member/updateUserInfo")
    R updateUserInfo(@RequestBody UserInfoTo userInfo);

    /**
     * 删除收货地址
     * @param ids 收货地址数据库唯一ID
     * @return
     */
    @RequestMapping("/member/memberreceiveaddress/delete")
    R deleteAddress(@RequestBody Long[] ids);

    /**
     * 添加收货地址，必须包含 memberId字段
     * @param address
     * @return
     */
    @PostMapping("/member/memberreceiveaddress/saveAddress")
    R saveAddress(@RequestBody Map<String, Object> address);
}
